package com.wenbing.miio.util;

import java.util.concurrent.TimeUnit;

/**
 * @author wen bing
 * @projectName: miio
 * @package: com.wenbing.miio.util
 * @className: TimeUtil
 * @date 2024/09/19 15:01
 **/
public class TimeUtil {

    /**
     * 获取当前时间戳 单位：ms
     * @return
     */
    public static long now() {
        return System.currentTimeMillis();
    }

    /**
     * 获取指定单位的当前时间戳
     * @param timeUnit
     * @return
     */
    public static long now(TimeUnit timeUnit) {
        return timeUnit.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS);
    }
}
